﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Ivy.Common.WinForms.Utilities
{
    public class WinFormsUtilities
    {
        #region Variables and Constants

        #endregion Variables and Constants

        #region Constructor & Destructor
        #endregion Constructor & Destructor

        #region Properties
        #endregion Properties

        #region Events
        #endregion Events

        #region Methods
        static public void ClearWinFormComponents(System.Windows.Forms.Form pForm)
        {
            foreach (System.Windows.Forms.Control lControl in pForm.Controls)
            {
                if (lControl is System.Windows.Forms.TextBox)
                    lControl.Text = string.Empty;
                else if (lControl is System.Windows.Forms.ComboBox)
                {
                    System.Windows.Forms.ComboBox lComboBox;
                    lComboBox = (ComboBox)lControl;
                    lComboBox.Items.Clear();
                }
                else if (lControl is System.Windows.Forms.ListBox)
                {
                    System.Windows.Forms.ListBox lListBox;
                    lListBox = (ListBox)lControl;
                    lListBox.Items.Clear();
                }
            }
        }
        #endregion Methods
    }
}
